'use strict';
module.exports = {
  async up (queryInterface, Sequelize) {
    await queryInterface.createTable('punch_records', {
      id: {
        allowNull: false,
        autoIncrement: true,
        primaryKey: true,
        type: Sequelize.INTEGER
      },
      punchPlanId: {
        type: Sequelize.INTEGER,
        allowNull: false,
        comment: '打卡计划ID'
      },
      dayNo: {
        type: Sequelize.STRING(8),
        allowNull: false,
        comment: '打卡日期，格式类似20250101'
      },
      detail: {
        type: Sequelize.STRING(100),
        allowNull: true,
        comment: '打卡详细描述，字数限制100'
      },
      created_at: {
        allowNull: false,
        type: Sequelize.DATE,
        defaultValue: Sequelize.literal('CURRENT_TIMESTAMP')
      },
      updated_at: {
        allowNull: false,
        type: Sequelize.DATE,
        defaultValue: Sequelize.literal('CURRENT_TIMESTAMP')
      }
    });
  },

  async down (queryInterface, Sequelize) {
    await queryInterface.dropTable('punch_records');
  }
};
